#include "Storage/ConnectionConfigFactory.hpp"

namespace Storage
{

void ConnectionConfigFactory::registerConnCfgConstructor( const NameString& cfgTypeName, const Details::ConnectionConfigConstructor& constructor )
{
	this->register_constructor( cfgTypeName, constructor);
}

// ---------------------------------------------------------------------------------------------------------------------

void ConnectionConfigFactory::getRegisteredConnCfgTypes( std::list< NameString>& result )
{
	const_iterator iter = this->begin(), endI = this->end();

	while( iter != endI)
	{
		result.push_back( iter->first);
		++iter;
	}
}

// ---------------------------------------------------------------------------------------------------------------------

ConnectionConfig* ConnectionConfigFactory::createConfig( const NameString& connTypeName, const NameString& connName) const
{
	assert( this->has_constructor_for( connTypeName));
	return (this->operator []( connTypeName))( connName);
}

} // namespace Storage
